<h:form id="formPlanoDeConta" 
        xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui"
        xmlns:pe="http://primefaces.org/ui/extensions"
        xmlns:f="http://java.sun.com/jsf/core">

    <script language="JavaScript" src = "scripts/script.js"/>

    <h:panelGrid style="width: 100%" >


        <h:panelGrid columns="2" style="width: 100%">            
            <h:panelGroup>
                <h:outputLabel value="Código"/><br/>
                <p:inputText value="#{planoDeContaBean.planoDeConta.codigo}" 
                             style="width: 120px"
                             maxlength="15" />
            </h:panelGroup>
            <h:panelGroup>
                <h:outputLabel value="Descrição"/><br/>
                <p:inputText value="#{planoDeContaBean.planoDeConta.descricao}" 
                             style="width: 260px" 
                             maxlength="200" />
            </h:panelGroup>
        </h:panelGrid>

        <h:panelGrid columns="3">
            <h:panelGroup>
                <h:outputLabel value="Nível" /><br/>
                <p:selectOneMenu value="#{planoDeContaBean.planoDeConta.nivel}" 
                                 style="width: 140px">
                    
                    <f:selectItem itemLabel="Selecione" />
                    <f:selectItems value="#{planoDeContaBean.niveis}" />
                    <f:converter converterId="simpleEntityConverter" />
                    
                </p:selectOneMenu>
            </h:panelGroup>
            <h:panelGroup>
                <h:outputLabel value="Tipo de Conta" /><br/>
                <p:selectOneMenu value="#{planoDeContaBean.planoDeConta.tipoConta}" 
                                 style="width: 140px">
                    <f:selectItem itemLabel="Selecione" />
                    <f:selectItem itemLabel="D - Débito" itemValue="D"/>
                    <f:selectItem itemLabel="C - Crédito" itemValue="C"/>
                </p:selectOneMenu>
            </h:panelGroup>
            <h:panelGroup>
                <h:outputLabel value="Saldo Inicial"/><br/>
                <pe:inputNumber value="#{planoDeContaBean.planoDeConta.saldoInicial}" 
                                style="width: 100px" 
                                thousandSeparator="."
                                decimalSeparator="," 
                                symbol="R$" />
            </h:panelGroup>
        </h:panelGrid>
        <h:panelGroup>

            <h:outputLabel value="Histórico" /><br/>
            <p:inputTextarea value="#{planoDeContaBean.planoDeConta.historico}" maxlength="500" style="width: 400px" />          

        </h:panelGroup>

    </h:panelGrid>

    <hr/>

    <p:commandButton id="btnGravar" value="Gravar" 
                     actionListener="#{planoDeContaBean.adicionarEditarFim}"
                     update="formPlanoDeConta" />

    <p:commandButton value="Cancelar" 
                     actionListener="#{planoDeContaBean.cancelar}"
                     immediate="true"/>

</h:form>


